Skip to content

Conversation

karenyrx
Copy link
Contributor

@karenyrx karenyrx commented Oct 8, 2025

Description

The existing GRPC errors returned only give the top level error, for example:

ERROR:
  Code: InvalidArgument
  Message: SearchPhaseExecutionException[all shards failed]

With this change, it will add more details (matching the HTTP one), which make it easier to debug, for example:

ERROR:
  Code: InvalidArgument
  Message: SearchPhaseExecutionException[all shards failed]; details={"error":{"root_cause":[{"type":"query_shard_exception","reason":"Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]","index":"test","index_uuid":"drv9MB6_RiWXddWq8us9Yg"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"test","node":"NFPsaNPMQC2BMVpjSIMQ_A","reason":{"type":"query_shard_exception","reason":"Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]","index":"test","index_uuid":"drv9MB6_RiWXddWq8us9Yg"}}]},"status":400}

which matches the HTTP one:


{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]",
        "index": "test",
        "index_uuid": "odCbh3PYRJqHOg5Z9we4cg"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "test",
        "node": "T-rqfJP1TbCbEnvqVUptFA",
        "reason": {
          "type": "query_shard_exception",
          "reason": "Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]",
          "index": "test",
          "index_uuid": "odCbh3PYRJqHOg5Z9we4cg"
        }
      }
    ]
  },
  "status": 400
}

A point to note is that it will return the HTTP status code as well ("status": 400) in GRPC error responses. Amenable to opinions if this is a blocker, but have left the entire XContent output here without modifications for now.

Related Issues

Resolves #18926

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request Libraries Lucene Upgrades and Libraries, Any 3rd party library that Core depends on, ex: nebula; team is respo labels Oct 8, 2025
Copy link
Contributor

@msfroh msfroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This is a lot more helpful.

Copy link
Contributor

github-actions bot commented Oct 8, 2025

❌ Gradle check result for 96b24d1: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Oct 8, 2025

❕ Gradle check result for 786c030: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.07%. Comparing base (8a1c55f) to head (667df97).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19568      +/-   ##
============================================
- Coverage     73.07%   73.07%   -0.01%     
+ Complexity    70635    70630       -5     
============================================
  Files          5723     5723              
  Lines        323490   323503      +13     
  Branches      46851    46851              
============================================
+ Hits         236401   236405       +4     
- Misses        67977    68023      +46     
+ Partials      19112    19075      -37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@karenyrx karenyrx marked this pull request as ready for review October 9, 2025 23:28
@karenyrx karenyrx requested a review from a team as a code owner October 9, 2025 23:28
Copy link
Contributor

❕ Gradle check result for 667df97: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@karenyrx karenyrx merged commit b4fda86 into opensearch-project:main Oct 10, 2025
36 checks passed
rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Oct 11, 2025
rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or improvement to existing feature or request Libraries Lucene Upgrades and Libraries, Any 3rd party library that Core depends on, ex: nebula; team is respo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] GRPC Status Codes and Error Handling

3 participants